﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// Summary description for TabberHeader
/// </summary>
public class TabberHeader : System.Web.UI.UserControl
{
    protected HtmlTableCell tdTabber;
    protected Literal ltTitle;

    public string DivID
    {
        get
        {
            if (ViewState["DivID"] == null)
            {
                ViewState["DivID"] = "div1";
            }
            return ViewState["DivID"].ToString();
        }
        set
        {
            ViewState["DivID"] = value;
        }
    }

    public bool Selected
    {
        get
        {
            if (ViewState["Selected"] == null)
            {
                ViewState["Selected"] = false;
            }
            return (bool)ViewState["Selected"];
        }
        set
        {
            ViewState["Selected"] = value;
        }
    }

    public string Title
    {
        get
        {
            if (ViewState["Title"] == null)
            {
                ViewState["Title"] = string.Empty;
            }
            return ViewState["Title"].ToString();
        }
        set
        {
            ViewState["Title"] = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        tdTabber.Attributes.Add("onclick", string.Format("OverChangeTabber(this, '{0}');", this.DivID));
        if (this.Selected)
        {
            string script = string.Format("<script>OverChangeTabber(document.getElementById('{0}'), '{1}');</script>", this.tdTabber.ClientID, this.DivID);
            this.Page.RegisterStartupScript("SelectTabber", script);
        }
        this.ltTitle.Text = this.Title;
        
    }
}
